//
//  CSLPlayer.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/4/7.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "CSLPlayer.h"

@implementation CSLPlayer

+(instancetype)shareAVPlayer {
    static CSLPlayer *player = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        player = [[CSLPlayer alloc] init];
       
    });
    return player;
}

-(void)playWithUrl:(NSString *)url{
    if (self.currentItem) {
        [self replaceCurrentItemWithPlayerItem:self.currentItem];
    }
    AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:url]];
    [self replaceCurrentItemWithPlayerItem:playerItem];
}

+ (void)play {
    CSLPlayer *player = [CSLPlayer shareAVPlayer];
    [player play];
}

+ (void)pause {
    CSLPlayer *player = [CSLPlayer shareAVPlayer];
    [player pause];
}

-(void)setName:(NSString *)name{
    
    _name = name;
    
    
}

-(void)setSingerName:(NSString *)singerName{
    
    
    _singerName = singerName;
    
}
@end
